package com.zsx.shopping.order.enums;

import lombok.Getter;

public enum PaymentType {

    CASH((byte) 1, "货到付款"),

    ONLINE((byte) 2, "在线支付"),

    PICKUP((byte) 3, "上门自提"),

    POST((byte) 4, "邮局汇款");

    @Getter
    private Byte id;

    @Getter
    private String method;

    PaymentType(Byte id, String method) {
        this.id = id;
        this.method = method;
    }

    public static PaymentType valueOf(Byte id) {
        PaymentType[] types = PaymentType.values();
        for (PaymentType type : types) {
            if (type.id.equals(id)) {
                return type;
            }
        }
        return null;
    }
}
